<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<!DOCTYPE html>
	<html lang="en" class="no-ie" style="overflow:hidden;">
		<head>
			<meta charset="UTF-8">
			<title>间隔柱状</title>
			<script>
				"object" != typeof ue || "object" != typeof ue.interface ? ("object" != typeof ue && (ue = {}), ue.interface = {},
					ue.interface.broadcast = function(e, t) {
						if ("string" == typeof e) {
							var o = [e, ""];
							void 0 !== t && (o[1] = t);
							var n = encodeURIComponent(JSON.stringify(o));
							"object" == typeof history && "function" == typeof history.pushState ? (history.pushState({}, "",
								"#" + n), history.pushState({}, "", "#" + encodeURIComponent("[]"))) : (document.location
								.hash = n, document.location.hash = encodeURIComponent("[]"))
						}
					}) : function(e) {
					ue.interface = {}, ue.interface.broadcast = function(t, o) {
						"string" == typeof t && (void 0 !== o ? e.broadcast(t, JSON.stringify(o)) : e.broadcast(t, ""))
					}
				}(ue.interface), (ue4 = ue.interface.broadcast);
			</script>
			<script src="./dist/echarts.min.js"></script>
			<script src="./static/js/jquery.min.js"></script>
			<script>
				$(function() {
					ue4("getSize", {
						mes: "get windows size"
					});
					ue4("getColor", {
						mes: "get all color"
					});
					ue4("getData", {
						mes: "get all data"
					});
					ue4("beginSize", {
						mes: BeginSize[0],
						mes2: BeginSize[1]
					});
					ue4("beginSizeY", {
						mes: BeginSize
					});
				});
				/*$(function () {
				    
				});*/
			</script>
			<style>
				* {
					margin: 0;
					padding: 0;
				}
			</style>
		</head>
		<body>
			<div id="main"></div>
			<!--
		dataTemp1: y轴数值;dataTemp2: x轴标题
		
		-->
			<script>
				let BeginSize = [235, 150];
				let myChart = null;
				const dataList = [{
						name: '马铃薯',
						value: '50.01',
					},
					{
						name: '黄瓜',
						value: '25.92',
					},
					{
						name: '大白菜',
						value: '25.93',
					},
					{
						name: '茄子',
						value: '15.93',
					},
					{
						name: '其他',
						value: '5.93',
					},
				];

				const colorList = ['rgba(199,220,255,1)', 'rgba(255,79,0,1)', 'rgba(63,200,148,1)',
				 'rgba(0,111,255,1)', 'rgba(222,222,222,1)'];
				 const colorList1 = ['rgba(199,220,255,0.7)', 'rgba(255,79,0,0.7)', 'rgba(63,200,148,0.7)',
				  'rgba(0,111,255,0.7)', 'rgba(222,222,222,0.7)'];
				function fresh() {

					let option = {
						backgroundColor:'rgba(13,29,70,1)',
						series: [{
								// 外圈
								name: '外圈',
								type: 'pie',
								radius: ['80%', '95%'],
								center: ['50%', '50%'],
								color:colorList,
								silent: true,
								itemStyle: {
									normal: {
										borderWidth: 5,
										borderColor:'rgba(13,29,70,1)',
										label: {
											show: false,
										},
										labelLine: {
											show: false,
										},
									},
								},
								data: dataList,
							},
							{
								// 内圈
								type: 'pie',
								radius: ['40%', '75%'],
								center: ['50%', '50%'],
								silent: true,
								color:colorList1,
								itemStyle: {
									normal: {
										borderWidth: 5,
										borderColor:'rgba(13,29,70,1)',
										label: {
											show: false,
										},
										labelLine: {
											show: false,
										},
									},
								},
								data: dataList,
							},
						],
					};
					myChart = echarts.init(document.getElementById('main'));
					myChart.setOption(option);
				}

				fresh();


				//浏览器测试用
				change(BeginSize[0], BeginSize[1]);

				function change(x, y) {
					let div = document.getElementById("main");
					//alert("I am an alert box!!");
					div.style.width = x + "px";
					div.style.height = y + "px";
					var myOption = myChart.getOption();
					myChart.resize();
					let types = []
					myOption.series.forEach((item) => {
						types.push(item.type)
					})
					return types
				}
				/************下面数据***********/
				ue.interface.TransData1 = function(data) {
					dataTemp1 = data;
					fresh();
				};
			</script>
		</body>
	</html>

	<body>
	</body>
</html>
